#include "threadPool.h"
int numStackInit(numStack_t * pstack)
{
    pstack=(numStack_t *)calloc(1,sizeof(numStack_t));
    for(int i=0;i<50;i++)pstack->stack_arr[i]=0;
    pstack->head=0;
    pstack->stackSize=0;
    pstack->tail=0;
    return 0;
}
int pushStack(numStack_t * pstack,int num)
{
    
    pstack->stack_arr[pstack->tail]=num;
    ++pstack->tail;
    ++pstack->stackSize;
    return 0;
}
int popStack(numStack_t * pstack)
{
    if(pstack->stackSize==0)
    {
        printf("栈为空\n");
        return 0;
    }
    pstack->stack_arr[pstack->tail-1]=0;
    --pstack->tail;
    --pstack->stackSize;
    return 1;
}
int visitStack(numStack_t * pstack)
{
    int n=pstack->tail;
    for(int i=0;i<n;i++)
    {
        printf("%d\t",pstack->stack_arr[i]);
    }
    printf("\n");
    return 1;
}
int topStack(numStack_t * Pstack)
{
    if(Pstack->stackSize==0)
    {
        printf("表为空\n");
        return 0;
    }
    return Pstack->stack_arr[Pstack->tail-1];
}
int empty(numStack_t * Pstack)
{
    if(Pstack->stackSize==0)return 1;
    else return 0;
}

